﻿using FPP.Models;
using NUnit.Framework;

namespace FPP.Tests.Models
{

    public class BachelorPersonTest
    {

        [Test]
        public void Valid()
        {
            Assert.IsTrue(true);
        }

        //Todo Should have a link to an image

        [TestFixture]
        public class AddAPerson : BaseTest
        {
            [TestFixtureSetUp]
            public void AddAPersonSetup()
            {
                _context = new FakeFppEntities();
            }

            [Test]
            public void PersonShouldHaveAName()
            {
                var repository = new FppRepository(_context);
                var bachelorPerson = new BachelorPerson();
                bachelorPerson.BachelorGameId = 1;

                var response = repository.AddBachelorPerson(bachelorPerson);

                Assert.IsFalse(response);

                bachelorPerson.Name = "Ben";

                response = repository.AddBachelorPerson(bachelorPerson);

                Assert.IsTrue(response);
            }

            [Test]
            public void PersonShouldReferenceABachelorGame()
            {
                var repository = new FppRepository(_context);
                var bachelorPerson = new BachelorPerson();
                bachelorPerson.Name = "Ben";

                var response = repository.AddBachelorPerson(bachelorPerson);

                Assert.IsFalse(response);

                bachelorPerson.BachelorGameId = 1;
                response = repository.AddBachelorPerson(bachelorPerson);

                Assert.IsTrue(response);
            }

        }
    }
}
